home *** CD-ROM | disk | FTP | other *** search
- pascal long main(var,CH,msg,par)
- int msg,var;
- ControlHandle CH;
- long par;
- {
- long l;
-
- l=0L;
- switch(msg){
- case 0:
- doDraw(CH);
- break;
- case 1:
- l=(long)doTest(par,CH);
- break;
- case 2:
- doCalc(par,CH);
- break;
- }
- return l;
- }
-
- doTest(par,CH)
- long par;
- ControlHandle CH;
- {
- Point pt;
-
- pt.v=HiWord(par);
- pt.h=LoWord(par);
- return (int)PtInRect(pt,&((**CH).contrlRect));
- }
-
- doCalc(par,CH)
- RgnHandle par;
- ControlHandle CH;
- {
- par=(RgnHandle)((long)par&0x7FFFFFFF);
- RectRgn(par,&((**CH).contrlRect));
- }
-
- doDraw(CH)
- ControlHandle CH;
- {
- int j,k,*p;
- Handle tItem;
- Rect r;
- RGBColor rgb,rgb1,rgb2;
- AuxCtlHandle ax;
- FontInfo inf;
-
- r=(**CH).contrlRect;
- j=StringWidth((**CH).contrlTitle);
- GetFontInfo(&inf);
- k=inf.ascent+inf.descent;
- k=(r.top+r.bottom+k)/2;
- MoveTo((r.left+r.right-j)/2,k-inf.descent);
- DrawString((**CH).contrlTitle);
- GetAuxCtl(CH,&ax);
-
- p=(int *)&(**(**ax).acCTable).ctTable[0].rgb.red;
- rgb.red=p[0]; /* 21845, 0x5555*/
- rgb.green=p[1]; /* 21845, 0x5555*/
- rgb.blue=p[2]; /* 21845, 0x5555*/
- rgb1.red=p[4]; /* 34952, 0x8888*/
- rgb1.green=p[5]; /* 34952, 0x8888*/
- rgb1.blue=p[6]; /* 34952, 0x8888*/
- rgb2.red=rgb2.green=rgb2.blue=0xFFFF;
-
- PenSize(2,2);
- RGBForeColor(&rgb);
- MoveTo(r.right-2,r.top);
- LineTo(r.left,r.top);
- LineTo(r.left,r.bottom-2);
- RGBForeColor(&rgb2);
- MoveTo(r.right-2,r.top+1);
- LineTo(r.right-2,r.bottom-2);
- LineTo(r.left,r.bottom-2);
- rgb2.red=rgb2.green=rgb2.blue=0;
- RGBForeColor(&rgb2);
- InsetRect(&r,2,2);
- FrameRect(&r);
-
- InsetRect(&r,2,2);
- if(!(**CH).contrlHilite){
- PenSize(1,1);
- RGBForeColor(&rgb);
- MoveTo(r.left,r.top);
- LineTo(r.left,r.bottom-2);
- PenSize(2,2);
- LineTo(r.right-2,r.bottom-2);
- Move(0,-1);
- PenSize(1,1);
- RGBForeColor(&rgb1);
- LineTo(r.left+1,r.bottom-3);
- LineTo(r.left+1,r.top);
- LineTo(r.right-1,r.top);
- Move(0,1);
- rgb2.red=rgb2.green=rgb2.blue=0xFFFF;
- RGBForeColor(&rgb2);
- LineTo(r.left+2,r.top+1);
- }
- else {
- MoveTo(r.right-2,r.top);
- RGBForeColor(&rgb);
- LineTo(r.left,r.top);
- PenSize(1,1);
- LineTo(r.left,r.bottom-3);
- PenSize(3,3);
- LineTo(r.right-3,r.bottom-3);
- PenSize(1,1);
- Move(2,-1);
- RGBForeColor(&rgb1);
- LineTo(r.left+1,r.bottom-4);
- LineTo(r.left+1,r.top+2);
- LineTo(r.right-1,r.top+2);
- }
- rgb2.red=rgb2.green=rgb2.blue=0;
- RGBForeColor(&rgb2);
- }
-